﻿Imports PowerTools
Namespace Classes

    <Serializable()> _
    Public Class LigneGrille

        'Public Function ObtenirCapacite(ByVal source As PouvoirsXML) As PouvoirsXMLPouvoir
        '    Dim p As PouvoirsXMLPouvoir
        '    Select Case Me.TypeCapacite
        '        Case enumTypePouvoir.Trait
        '            p = source.Traits.SingleOrDefault(Function(t) (t.Id = Me.ID))
        '        Case enumTypePouvoir.Aptitude
        '            p = source.Aptitudes.SingleOrDefault(Function(t) (t.Id = Me.ID))
        '        Case enumTypePouvoir.Pouvoir
        '            p = source.Pouvoirs.SingleOrDefault(Function(t) (t.Id = Me.ID))
        '        Case Else
        '            Throw New ArgumentException("Mauvaise valeur typeCap " + Me.TypeCapacite)
        '    End Select
        '    Return p
        'End Function

        Private _livre As String
        Public Sub New(ByVal p As PouvoirsXMLPouvoir)
            Livre = p.livre
            Pouvoir = p.nom
            ID = p.Id
            TypePouvoir = p.type
            NomOrigine = p.nomorigine
            Niveau = If(p.niveau = "", 0, Convert.ToInt32(p.niveau))

            TypeCapacite = p.TypeCapacite
            Selectionne = False
            TexteType = p.textetype
            Origine = p.origine
        End Sub

        Private _origine As String

        Private _selectionne As Boolean

        Private _typeCapacite As enumTypePouvoir

        Private _pouvoir As String, _ID As String, _nomOrigine As String

        Private _typePouvoir As String

        Private _niveau As Integer

        Private _texteType As String

        Public Property NomOrigine() As String
            Get
                Return _nomOrigine
            End Get
            Set(ByVal value As String)
                _nomOrigine = value
            End Set
        End Property
        Public Property ID() As String
            Get
                Return _ID
            End Get
            Set(ByVal value As String)
                _ID = value
            End Set
        End Property

        Public Property Livre() As String
            Get
                Return _livre
            End Get
            Set(ByVal value As String)
                _livre = value
            End Set
        End Property

        ''' <summary>
        ''' Nom du pouvoir
        ''' </summary>
        ''' <value>The pouvoir.</value>
        Public Property Pouvoir() As String
            Get
                Return _pouvoir
            End Get
            Set(ByVal value As String)
                _pouvoir = value
            End Set
        End Property

        Public Property TypePouvoir() As String
            Get
                Return _typePouvoir
            End Get
            Set(ByVal value As String)
                _typePouvoir = value
            End Set
        End Property

        Public Property Niveau() As Integer
            Get
                Return _niveau
            End Get
            Set(ByVal value As Integer)
                _niveau = value
            End Set
        End Property

        ''' <summary>
        ''' Determine s'il s'agit d'un pouvoir, attribut ou Trait
        ''' </summary>
        ''' <value>Enum TypePouvoir.</value>
        Public Property TypeCapacite() As enumTypePouvoir
            Get
                Return _typeCapacite
            End Get
            Set(ByVal value As enumTypePouvoir)
                _typeCapacite = value
            End Set
        End Property

        Public Property Selectionne() As Boolean
            Get
                Return _selectionne
            End Get
            Set(ByVal value As Boolean)
                _selectionne = value
            End Set
        End Property

        Public Property TexteType() As String
            Get
                Return _texteType
            End Get
            Set(ByVal value As String)
                _texteType = value
            End Set
        End Property

        Public Property Origine() As String
            Get
                Return _origine
            End Get
            Set(ByVal value As String)
                _origine = value
            End Set
        End Property
    End Class
End Namespace